<%@ page import="org.apache.naming.java.javaURLContextFactory"%>
<%@page import="java.util.Date,java.util.List,com.rbcs.reimb.model.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>

<link rel="stylesheet" type="text/css" href="${ctx}/styles/ec/ecside_style.css" />
<%@include file="/common/meta.jsp"%>
<%@include file="/common/validator.jsp"%>
<title>报销申请管理</title>
</head>
<body>
<div class="x-panel" style="width: 100%">
<div class="x-panel-header">报销申请管理</div>
<div><%@ include file="/common/messages.jsp"%></div>
<div align="center" style="width: 100%">
<s:form action="saveParent.do" id="saveParent" method="post">
	<s:hidden name="model.id" />

	<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-left-width:0px; border-top-width:0px; padding: 4px 2px; margin-top: 10px;">
		<tr height="30" style="padding: 8px 2px;"> 
           <td align="center" colspan="8"><font size="3">报销单</font></td>
        </tr>	
        <tr height="30">
           <td align="right" width="120">报销单号：</td>
           <td  colspan="2" >
           		<s:textfield  id="singleNo" name="model.singleNo" cssClass="required" cssStyle="width:135px; border:1px dotted #808080;"></s:textfield >
           		<font color="red">*</font>
			</td>
           <td align="right" width="80">部门名称：</td>
           <td width="140" colspan="1">&nbsp;${model.dept.name}</td>	 			
           <td align="right" width="120">制单日期：</td>
           <td  colspan="2" width="150">&nbsp;<s:date name="model.createDate" format="yyyy-MM-dd HH:mm"/></td>		
        </tr>    

        <tr height="30">
           <td align="right">销账金额：</td>
           <td colspan="4">
                <s:textfield id="borrowAmount" name="model.borrowAmount" cssStyle="width:135px;border:1px dotted #808080;" readonly="true"/>
			</td>
           <td align="right">余&nbsp;&nbsp;&nbsp;&nbsp;款：</td>
           <td colspan="2">
                <s:textfield id="balance" name="model.balance" cssStyle="width:150px;border:1px dotted #808080;" readonly="true"/>
                <s:hidden id="reimbTotal" name="model.amount"/>  
                <s:hidden id="offsetAmount" name="model.offsetAmount"/>  
			</td>						
        </tr>	
                
        <tr>
           <td align="right">销账借款单号：</td>
           <td  colspan="4">
                <s:textfield id="totalBorrowNos" name="model.totalBorrowNos" onclick="openSelectborrows('total')" cssStyle="width:380px;border:1px dotted #808080;" readonly="true" title="单击此处选择完全销账的借款单"/>
                <s:hidden id="totalBorrowIds" name="model.totalBorrowIds" />
                <s:hidden id="totalBorrowAmounts"/>
                <s:hidden id="totalRepayAmounts"/>
                <s:hidden id="totalNoRepayAmounts" name="model.totalNoRepayAmounts"/>
			</td>
           <td  align="right">部分销账借款单号：</td>
           <td colspan="2">
                <s:textfield id="partBorrowNos" name="model.partBorrowNos" onclick="openSelectborrows('part')" cssStyle="width:150px;border:1px dotted #808080;" readonly="true" title="单击此处选择部分销账的借款单"/>
                <s:hidden id="partBorrowIds" name="model.partBorrowIds"/>
                <s:hidden id="partBorrowAmounts"/>
                <s:hidden id="partRepayAmounts"/>
                <s:hidden id="partNoRepayAmounts"/>              
			</td>      
        </tr>     
                  	
	</table>

	<table align="center" width="96%"> 
	   <tr><td><!--<a href="${ctx}/reimb/editChild.do?parentReimbId=${model.id}" >-->
	   <a href="#" onclick="editChild('${model.id}')" >
       <img src="${ctx}/images/icons/add.gif" style="width: 12px; height: 12px;" />&nbsp;添加子单</a>	
      </td></tr>
	<tr>
	  <td>
	  <div align="left">
	  <iframe id="iframe_childReimb" name="iframe_childReimb" width="100%" height="310" src="${ctx}/reimb/childIndex.do?parentReimbId=${model.id}" frameborder="0" scrolling="no"></iframe><br>
	 </div>
	 </td>
 </tr>
	
	</table>

	<table width="600px" style="margin-bottom: 10px;">
		<tr>
			<td style="text-align: center;">
			  <s:submit value="保存" cssClass="button" onclick="return saveyz();"/> 
			  &nbsp;&nbsp;
			  <input class="button" type="button" value="重置" onclick="reset1()">
			  &nbsp;&nbsp;
			  <s:reset value="返回" cssClass="button" onclick="history.go(-1)"/>			  
			</td>
		</tr>
	</table>
</s:form>
</div>
</div>
<script type="text/javascript" src="${ctx }/pages/rbcs/reimb/editParentjs.js"></script>
<script type="text/javascript">
function editChild(id) {
	var url = '${ctx}/reimb/editChild.do?parentReimbId=' + id;
	var styles = "dialogWidth:920px; dialogHeight:465px; status:no; scroll:yes; help:no";
	var reimbChild = window.showModalDialog(url, null, styles);
    if (reimbChild.flag != null) {
       window.location.href = '${ctx}/reimb/editParent.do?model.id=' + id;	
    }
}

/**
 * 点击保存以前的验证
 */
function saveyz(){
  if(confirm('您确定保存该报销申请信息吗？')){
	  return true;
  } else {
     return false;
  }   
}

/**
 * 重置销账借款单号
 */
function reset1() {
  $("#totalBorrowNos").val("");
  $("#totalBorrowIds").val(""); 
  $("#totalBorrowAmounts").val(""); 
  $("#totalRepayAmounts").val(""); 
  $("#totalNoRepayAmounts").val("");
  
  $("#partBorrowNos").val("");
  $("#partBorrowIds").val(""); 
  $("#partBorrowAmounts").val(""); 
  $("#partRepayAmounts").val(""); 
  $("#partNoRepayAmounts").val("");
  $("#borrowAmount").val("");
  var reimbTotal = document.getElementById("reimbTotal").value;
  $("#balance").val(Number(reimbTotal).toFixed(2));
} 
</script>
</body>
</html>